// data-数据 
// el-元素 
// exp-
function SelfVue(data, el, exp) {
    var self = this;
    this.data = data;
    console.log(data)
    // 给每个DATA添加set/get
    Object.keys(data).forEach(function (key) {
        self.proxyKeys(key);
    });

    observe(data);
    el.innerHTML = this.data[exp];  // 初始化模板数据的值
    // new Watcher(this, exp, function (value) {
    //     el.innerHTML = value;
    // });
    return this;
}

SelfVue.prototype = {
    proxyKeys: function (key) {
        var self = this;
        Object.defineProperty(this, key, {
            enumerable: false,
            configurable: true,
            get: function proxyGetter() {
                console.log('proxyKeys_get')
                return self.data[key];
            },
            set: function proxySetter(newVal) {
                console.log('proxyKeys_set')
                self.data[key] = newVal;
            }
        });
    }
}
